/* main.c */
#include "app_inc.h"

int main(void)
{
	uint8_t ch;
    uint8_t line, row;

    /* Init board hardware. */
    BOARD_InitBootPins();
    BOARD_BootClockRUN();

    /* Initialize debug console. */
    BOARD_InitDebugConsole(); /* Flexcomm0 - UART0, 115200. */

    PRINTF("SPI_OLEDDisplay Demo.\r\n");
    PRINTF("build time: %s, %s\r\n", __TIME__, __DATE__);

    OLED_Init();
    OLED_PutStrP8x16(0U, 0U, (uint8_t *)"HelloWorld.");
#if 0
    OLED_PutCharP6x8(0U, 0U, 'H');
    OLED_PutCharP6x8(0U, 8U, 'E');
    OLED_PutCharP6x8(1U, 8U, 'N');
#endif
    
    GETCHAR();
    line = 0U;
    row = 0U;
    while (1)
    {
        ch = GETCHAR();
        PUTCHAR(ch);
        
        if ( (line == 0U) && (row == 0U) )
        {
            OLED_ClearScreen(0x00);
        }
        OLED_PutCharP8x16(line, row, ch);
        
        row += 8U;
        if (row >= OLED_ROW_COUNT_MAX)
        {
            row = 0U;
            line += 2U;
            if (line >= OLED_LINE_COUNT_MAX)
            {
                line = 0U;
            }
        }
    }
}


/* EOF. */

